home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_319 / cnewssrc / uupc.lzh / uupc / host.c < prev    next >
C/C++ Source or Header  |  1990-01-16  |  1KB  |  87 lines

  1. /*
  2.  *    host.c
  3.  *
  4.  *    Amiga front-end for the mailer-type packages.  #define MAIN to
  5.  *    be the routine you want to call when this code is run.  This
  6.  *    module allows you to use longjmp( &dcpexit ) to return to main()
  7.  *    and it sets up the environment and such for you.
  8.  *
  9.  *    $Id: host.c,v 1.1 90/01/16 10:25:41 crash Exp Locker: crash $
  10.  */
  11.  
  12. #ifndef lint
  13. static char RCSid[] = "$Id: host.c,v 1.1 90/01/16 10:25:41 crash Exp Locker: crash $";
  14. #endif /* lint */
  15.  
  16. #include <stdio.h>
  17. #include "host.h"
  18.  
  19. #ifndef _U
  20. # include <ctype.h>
  21. #endif
  22.  
  23. #include <setjmp.h>
  24.  
  25. #ifndef EACCES
  26. # include <errno.h>
  27. #endif
  28.  
  29. static char *curdir;
  30. char *getcwd();
  31. int chdir();
  32.  
  33. int    debuglevel;        /* debugging level */
  34. jmp_buf    dcpexit;
  35.  
  36. main( argc, argv )
  37. int    argc;
  38. char *argv[];
  39. {
  40.     int ret = 0;
  41.  
  42.     /* Amiga specific prolog */
  43.     loadenv();
  44.     curdir = getcwd( NULL, 0 );
  45.  
  46. #ifdef CWDSPOOL
  47.     chdir( spooldir );
  48. #endif
  49.  
  50.     /* setup longjmp for error exit's */
  51.     if ( setjmp( dcpexit ) == 0 )
  52.         ret = MAIN( argc, argv );
  53.  
  54.     /* Amiga specific epilog */
  55.     exitenv();
  56.     chdir( curdir );
  57.     exit( ret );
  58. }
  59.  
  60.  
  61. /* canonical name conversio routines
  62.  *
  63.  *    inportpath    canonical -> host
  64.  *    exportpath    host -> canonical
  65.  *
  66.  *    host        your local pathname format
  67.  *    canonical    unix style
  68.  */
  69.  
  70. importpath( host, canon )
  71. register char *host;
  72. char *canon;
  73. {
  74.     strcpy( host, canon );
  75.     if ( *host == '/' )
  76.         *host = ':';
  77. }
  78.  
  79. exportpath( canon, host )
  80. char *host;
  81. register char *canon;
  82. {
  83.     strcpy( canon, host );
  84.     if ( *canon == ':' )
  85.         *canon = '/';
  86. }
  87.